const koa = require('koa');
const cors = require('koa-cors');
const userRouter = require('./api/user');
const deployRouter = require('./api/deploy');
const sseRouter = require('./api/sse');
const bodyParser = require('koa-bodyparser');

const app = new koa();

console.log(app.env);

app.use(cors());
app.use(bodyParser());
app.use(userRouter.routes());
app.use(deployRouter.routes());
app.use(sseRouter.routes());

// app.use(async (ctx, next) => {
//   console.log('Middleware 1 - Start');
//   await next(); // 继续执行下一个中间件
//   console.log('Middleware 1 - End');
// });



app.listen(9000, () => {
  console.log('服务启动');
});